//模拟用户结算页面
import { reqGetAddresslist } from '@/api/index'
const state = {
    allAddress: [],
    shopGoods: []
}
const mutations = {
    updateAddress(state, allAdress) {
        state.allAddress = allAdress
    },
    //购买支付的商品
    getShopgoods(state, newGoods) {
        state.shopGoods = newGoods
        


        // console.log(state.shopGoods);
        console.log(`~~~~~~~~`);

    }
}
const actions = {
    //获取所有收货地址
    async setAddress(context) {
        const res = await reqGetAddresslist()
        console.log(res.data.data.addressInfo);
        context.commit('updateAddress', res.data.data.addressInfo)

    },
    //更新结算的商品
    setShopcart(context, newGoods) {

        context.commit('getShopgoods', newGoods)

    }
}
const getters = {

}
export default {
    namespaced: true,
    state, mutations, actions, getters
}